package flag

import (
	"leading/global"
	"leading/models"
)

// 初始化数据库迁移

func MakeMigration() {
	global.Log.Infof("开始迁移数据库")
	err := global.DB.Set("gorm:table_options", "ENGINE=InnoDB CHARSET=utf8").AutoMigrate(
		&models.UserModel{},
		&models.FileModel{},
		&models.ShareModel{},
		&models.TestModel{},
	)

	if err != nil {
		global.Log.Error("数据库迁移失败:%v", err)
		return
	}
	global.Log.Infof("数据库迁移成功")
}
